#include<iostream>
#include"Observer.h"
#include"Observerable.h"
using namespace std;

class News :public Observerable
{
};

class User1 :public Observer
{
	void Update(void* pArg)
	{
		cout << "User1 Got News: " << reinterpret_cast<char*> (pArg) << endl;
	}
};

class User2 :public Observer
{
	void Update(void* pArg)
	{
		cout << "User2 Got News: " << reinterpret_cast<char*> (pArg) << endl;
	}
};

int main()
{
	User1 u1;
	User2 u2;

	News n1;
	n1.GetSomeNews("T0");
	cout << n1.GetObseverCount() << endl;

	n1.Attach(&u1);
	n1.Attach(&u2);
	n1.GetSomeNews("T1");
	cout << n1.GetObseverCount() << endl;

	n1.Detach(&u2);
	n1.GetSomeNews("T2");
	cout << n1.GetObseverCount() << endl;

	n1.DetachAll();
	n1.GetSomeNews("T3");
	cout << n1.GetObseverCount() << endl;

	return 0;
}